<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/6
 * Time: 10:09
 */

echo '<h1>登录验证</h1>';
if(empty($_POST['username'])){
    echo '用户名为空';
    die;
}
if(empty($_POST['pwd'])){
    echo '密码为空';
    die;
}
$username =$_POST['username'];
$password =$_POST['pwd'];
$pps=md5($username.$password.time());
if ($username=='admin' && $password=='888888'){
    setcookie('Token','$pps',time()+24*3600);
    if (empty($_COOKIE['name'])){
        echo'<a href="index.php">前往用户中心页面</a>';
    }else{
        echo '创建失败';
    }

}else{
    echo '登录失败';
    echo '<a href="login.php">返回登录页面</a>';
}